class ValidateError(ValueError):
    def __init__(self,message,*args,**kwargs):
        super().__init__(message,*args,**kwargs)


def validate_account(username,password):
    if username == '':
        raise ValidateError('用户名不能为空')
    if password == '':
        raise ValueError('密码不能空')
    if username != 'andy' or password != '123456':
        raise ValueError('用户名和密码不匹配')

username = input('请输入如用户名:')
password = input('请输入如密码:')
try:
    validate_account(username,password)
except ValueError as e:
    print(e)
else:
    print("用户名和密码正确")
